# L = list(range(1,10))
# # 可迭代元素的元素个数要和段数保持一致
# # L[0:10:2] = ["hello","a","a","a","a","b"]
# print(L)
# print(len(L))
# print(max(L))
# print(min(L))
# print(sum(L))
# L.append(4)
# print(L)
# L.insert(0,"a")
# print(L)

# name1 = [["张三","李四","王五","赵六"],"陈七"]
# name2 = copy.copy(name1)
# name3 =copy.deepcopy(name1)
# name1 [0][0] = "喜羊羊"
# name1 [1] = "懒羊羊"
# print(name1)
# print(name2)
# print(name3)

# L = [x * x for x in range(1,6)]
# print(L)
#
# L = [x * y for x in range(1,4) for y in range(1,4)]
# print(L)
#
# L = [x * y for x in range(1,4) for y in range (1,4) if y%2!=0]
# print(L)
#
# L = [x * y for x in range(1,4) for y in range (1,4) if x%2!=0 if y%2!=0]
# print(L)
#
# num = []
# for i in range(2,1001):
#     L = [i%x for x in range(2,i-1)]
#     if all(L):
#         num.append(i)
# print(num)
#
#
# for i in range(2,1001):
#     L = [i%x for x in range(2,i-1)]
#     if all(L):
#         L.count(L)
# print(L.count(L))

# print("%s and %*.*f" % ("abc",4,5,3.1415926))

# tup = (10,20,30, 'a')
# print(tup[3])
# # tup[0] = 100
# # del tup[0]
# # print(tup)
# t1 = (1,2)
# t2 = (3,4)
# print(t1 + t2)
#
# t1 += (5,)
# print(t1)

# t = (10,20,30)
# print(22 in t)

# t = (5,90,15,20)
#  L = [1,7,0,2,6]
# # print(t[1:3])
# # print(t[::-1])#逆序
# # L.sort()
# # t.sort()#不支持
# print(sorted(t))
# print(t)
# L = [1,7,0,2,6]
# L1 = [2,6,9,"123","yuu"]
# L2 = ["wedf","456","334e4r","89tf"]
# t1 = (2,6,9,"123","yuu")
# t2 = ("wedf","456","334e4r","89tf")
#
# L2.reverse()
# print(L2)
# L2.sort(reverse=True)
# print(L2)
# t1.sort(reverse=True)
# print(t1)


# D = {"name":"饶加蓉","age":18,"addr":"湖南","age":10}
# d1 = {}
# d2 = dict([("name","张三"),("age",30)])
# d3 = dict(name="zhangsan",age=20)
# d2["addr"] = "杭州"
# del(d3["age"])
# D["name"] = "王五"
# d3.get("name")
# # print(d2.get("age"))
# # print(d1["name"])
# print(d3)
# print(d2)
# print(d3)
# print(D)

# L = [1,5,93,3]
# t = (12345,2345,2345)
# d = {None:"郭德纲"}

# d = {"name":"zhangsan","age":18,"addr":"天津","job":"python"}
# print(len(d))
# print(d.keys())
# print(d.values())
# print(d.items())   #键值对组成的元组，由若干个元组组成了列表，也是以对象的形式


print("个人名片管理系统，请输入要进行的操作：")
print("1:添加一个名片")
print("2:删除一个名片")
print("3:修改一个名片")
print("4:查询一个名片")
print("5:显示所有系统")
print("6:退出系统")
cards = [{"name":"zhangsan","age":18,"addr":"天津"} ]
while True:
    #获得用户输入的数据
    num = int(input("请输入序号（输入6直接退出系统）"))
    if num == 1:
        #创建字典,再将字典存入列表
        card = {}
        name = input("请输入要添加的名片的name")
        age = int(input("请输入要添加名片的age"))
        addr = input("请输入要添加名片的addr")
        card["name"] = name
        card["age"] = age
        card["addr"] = addr
        cards.append(card)
        print(cards)
    if num == 2:
        name = input("请输入要添加的名片的name")
        flag = False
        for temp in cards:
            if temp["name"] == name:
                cards.remove(temp)
                flag = True
        if flag == False:
            print("没有找到")
    if num == 3:
        name = input("请输入要修改的名片的name")
        flag = False
        for temp in cards:
            if temp["name"] == name:
                temp["age"] = input("要修改的age")
                temp["addr"] = input("要修改的addr")
                flag = True
                print(cards)
        if flag == False:
            print("没有找到")
    if num == 4:
        name = input("请输入要查询的名片的name")
        flag = False
        for temp in cards:
            if temp["name"] == name:
                flag = True
                print("查询结果：")
                print(cards)
        if flag == False:
            print("没有找到")
    elif num == 5:
        print(cards)
    elif num == 6:
        print("系统已退出")
        break
    else:
        print("输入不对请重新输入1-6之间的数字")